package com.yzh.String;

/**
 * @author : Bruce
 * @date: 2024/7/16 - 07 - 16 - 19:48
 * @Description: com.yzh.String
 * @version: 1.0
 */
public class MyStringBuilder {

    public static void main(String[] args) {
        //    //创建StringBuilder的对象：
//    StringBuilder sb3 = new StringBuilder();
//    //表面上调用StringBuilder的空构造器，实际底层是对value数组进行初始化，长度为16
//    StringBuilder sb2 = new StringBuilder(3);
//    //表面上调用StringBuilder的有参构造器，传入一个int类型的数，实际底层就是对value数组进行初始化，长度为你传入的数字
//    StringBuilder sb = new StringBuilder("abc");
//    System.out.println(sb.append("def").append("aaaaaaaa").append("bbb").append("ooooooo").toString());;//链式调用方式：return this
        StringBuilder s1 = new StringBuilder();
        StringBuilder s2 = new StringBuilder(3);


        StringBuilder s3 = new StringBuilder("abc");
        StringBuilder s4 = s3;
        String S3 = s3.append("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").toString();
        System.out.println(S3.equals(s4));

        String S5 = "a";
        S5 = "aa";

        String s11 = "aaa";
        String s12 = "aaa";
    }
}
